package com.applink.sell_proof;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.applink.sell_proof.model.MyImage;
import com.applink.sell_proof.urlimageviewhelper.GalleryViewPager;
import com.applink.sell_proof.urlimageviewhelper.UrlPagerAdapter;

public class parsePDFActivity extends Activity {

	private List<MyImage> mUrlPdf = new ArrayList<MyImage>();
	private static final int SHOW_PDF = 0;
	private GalleryViewPager mViewPager;
	private Context mContext;
	private String[] image = {
			"http://203.81.37.250/MobileWebService/proofofsaleservice/PDFUpload/C250BE-May2012.jpg",
			"http://203.81.37.250/MobileWebService/proofofsaleservice/PDFUpload/C200BE-May2012.jpg" };

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.view_pdf);
		mContext = this;
		initView();

	}

	private void initView() {
		mViewPager = (GalleryViewPager) findViewById(R.id.gallery_pdf_file);
		for (int i = 0; i < image.length; i++) {

			MyImage mi = new MyImage();
			mi.setImageLocation(Uri.parse(image[i]));
			mUrlPdf.add(mi);
		}

		mHandler.sendEmptyMessage(SHOW_PDF);
	}

	private Handler mHandler = new Handler(new Handler.Callback() {

		@Override
		public boolean handleMessage(Message arg0) {
			switch (arg0.what) {
			case SHOW_PDF:
				UrlPagerAdapter pagerAdapter = new UrlPagerAdapter(mContext,
						mUrlPdf);
				mViewPager.setAdapter(pagerAdapter);
				break;

			default:
				break;
			}
			return false;
		}
	});
}
